CREATE TABLE [dbo].[tb_Embargos]
(
[idEmbargo] [int] NOT NULL IDENTITY(1, 1),
[Agente] [int] NOT NULL,
[Desde] [datetime] NOT NULL,
[Hasta] [datetime] NULL,
[TipoEmbargo] [int] NOT NULL,
[Juzgado] [int] NOT NULL,
[Expediente] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[MontoTotal] [float] NULL,
[MontoMensual] [float] NULL,
[MontoDescontado] [float] NULL,
[Porcentaje] [int] NULL,
[UltimaLiquidacionDefinitiva] [int] NULL,
[FormulaDeDescuento] [int] NOT NULL,
[CuentaDestino] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Banco] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Embargos] ADD CONSTRAINT [PK_tb_Embargos] PRIMARY KEY NONCLUSTERED  ([idEmbargo]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Embargos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Embargos_tb_Agentes] FOREIGN KEY ([Agente]) REFERENCES [dbo].[tb_Agentes] ([idAgente])
GO
ALTER TABLE [dbo].[tb_Embargos] ADD CONSTRAINT [FK_tb_Embargos_tb_Bancos] FOREIGN KEY ([Banco]) REFERENCES [dbo].[tb_Bancos] ([idBanco])
GO
ALTER TABLE [dbo].[tb_Embargos] ADD CONSTRAINT [FK_tb_Embargos_tb_FormulasDeDescuento] FOREIGN KEY ([FormulaDeDescuento]) REFERENCES [dbo].[tb_FormulasDeDescuento] ([IdFormula])
GO
ALTER TABLE [dbo].[tb_Embargos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Embargos_tb_Juzgados] FOREIGN KEY ([Juzgado]) REFERENCES [dbo].[tb_Juzgados] ([idJuzgado])
GO
ALTER TABLE [dbo].[tb_Embargos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Embargos_tb_TiposDeEmbargos] FOREIGN KEY ([TipoEmbargo]) REFERENCES [dbo].[tb_TiposDeEmbargos] ([idTipoEmbargo])
GO
ALTER TABLE [dbo].[tb_Embargos] WITH NOCHECK ADD CONSTRAINT [FK_tb_Embargos_tb_Liquidaciones] FOREIGN KEY ([UltimaLiquidacionDefinitiva]) REFERENCES [dbo].[tb_Liquidaciones] ([idLiquidacion])
GO
